Completed
Push — master ( 200a7f...c04988 )
by Rafael S.
01:42
created

wavefile-header.js ➔ ???   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 98

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
nc 1
dl 0
loc 98
rs 8.3352
cc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
/*
2
 * WaveFileHeader class
3
 * A structure representing a WAVE file header.
4
 * Copyright (c) 2017-2018 Rafael da Silva Rocha.
5
 * https://github.com/rochars/wavefile
6
 *
7
 */
8
9
/**
10
 * Wave file headers.
11
 */
12
class WaveFileHeader {
13
14
    constructor() {
15
        /**
16
         * "RIFF"
17
         * @type {string}
18
         */
19
        this.chunkId = "";
20
        /** @type {number} */
21
        this.chunkSize = 0;
22
        /**
23
         * "WAVE"
24
         * @type {string}
25
         */
26
        this.format = "";
27
        /**
28
         * "fmt "
29
         * @type {string}
30
         */
31
        this.fmtChunkId = "";
32
        /** @type {number} */
33
        this.fmtChunkSize = 0;
34
        /** @type {number} */
35
        this.audioFormat = 0;
36
        /** @type {number} */
37
        this.numChannels = 0;
38
        /** @type {number} */
39
        this.sampleRate = 0;
40
        /** @type {number} */
41
        this.byteRate = 0;
42
        /** @type {number} */
43
        this.blockAlign = 0;
44
        /** @type {number} */
45
        this.bitsPerSample = 0;
46
47
        /** @type {number} */
48
        this.cbSize = 0;
49
50
        /** @type {number} */
51
        this.validBitsPerSample = 0;
52
53
        /**
54
         * "fact" 
55
         * @type {string} 
56
         */
57
        this.factChunkId = "";
58
        /** @type {number} */
59
        this.factChunkSize = 0;
60
        /** @type {!Array<number>} */
61
        this.factChunkData = [];
62
        /** @type {number} */
63
        this.dwSampleLength = 0;
64
65
        /**
66
         * "cue "
67
         * @type {string}
68
         */
69
        this.cueChunkId = "";
70
        /** @type {number} */
71
        this.cueChunkSize = -1;
72
        /** @type {!Array<number>} */
73
        this.cueChunkData = [];
74
75
        /**
76
         * "data"
77
         * @type {string}
78
         */
79
        this.dataChunkId = "";
80
        /** @type {number} */
81
        this.dataChunkSize = 0;
82
        /**
83
         * "bext"
84
         * @type {string}
85
         */
86
        this.bextChunkId = "";
87
        /** @type {number} */
88
        this.bextChunkSize = 0;
89
        /** @type {!Array<number>} */
90
        this.bextChunkData = [];
91
        /** @type {!Object} */
92
        this.bextChunkFields = {
93
            "description": "", //256
94
            "originator": "", //32
95
            "originatorReference": "", //32
96
            "originationDate": "", //10
97
            "originationTime": "", //8
98
            "timeReferenceLow": "", //DWORD
99
            "timeReferenceHigh": "", //DWORD
100
            "version": "", //WORD
101
            "UMID_0 ": "", //byte
102
            "UMID_63 ": "", //byte
103
            "loudnessValue": "", //WORD
104
            "loudnessRange": "", //WORD
105
            "maxTruePeakLevel": "", //WORD
106
            "maxMomentaryLoudness": "", //WORD
107
            "maxShortTermLoudness": "", //WORD
108
            "reserved": "", //180
109
            "codingHistory": "" // string, unlimited
110
        };
111
    }
112
}
113
114
module.exports = WaveFileHeader;
115